function refrushRank(type,obj){
	jQuery("#openDiv").find("a").removeClass("cur");
	jQuery(obj).addClass("cur");
	var url = "/active/refrushRank.do?type="+type+"&random="+Math.round(Math.random()*100);
	jQuery("#openList").load(url,null,function (data){
	});
	
}

function refrushMakerRank(type,obj){
    jQuery(".rankingsUl").find(".selectedLi").removeClass("selectedLi");
    jQuery(obj).addClass("selectedLi");
    var url = "/active/refrushMakerRank.do?type="+type+"&random="+Math.round(Math.random()*100);
    jQuery("#rankList").load(url,null,function (data){
    });

}
/*分享调用*/
function setupWebViewJavascriptBridge(callback) {
	if (window.WebViewJavascriptBridge) {
		return callback(WebViewJavascriptBridge);
	}
	if (window.WVJBCallbacks) {
		return window.WVJBCallbacks.push(callback);
	}
	window.WVJBCallbacks = [callback];
	var WVJBIframe = document.createElement('iframe');
	WVJBIframe.style.display = 'none';
	WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
	document.documentElement.appendChild(WVJBIframe);
	setTimeout(function() {document.documentElement.removeChild(WVJBIframe);}, 0);
}
function share(obj){
	if(window.appAgent && window.appAgent.share) {
		window.appAgent.share(JSON.stringify(obj));
	} else {
		setupWebViewJavascriptBridge(function(bridge) {
			bridge.callHandler('share', obj, function(response) {
				// noop
			});
		});
	}
}



function showreplayFutureActiveBlock(){
	dialogBoxShadow();
	document.getElementById("replayFutureActive").style.display="block";
}
function closereplayFutureActiveBlock(){
	dialogBoxHidden();
	document.getElementById("replayFutureActive").style.display="none";
}
function showGiftGetBlock(elme){
	dialogBoxShadow();
	document.getElementById("giftGet").style.display="block";
	document.getElementById("giftGetInformation").innerHTML = elme;
}

function closeGiftGetBlock(){
	dialogBoxHidden();
//	document.getElementById("dialogBoxShadowActive").style.display="none";
	document.getElementById("giftGet").style.display="none";
	document.getElementById("giftGetInformation").innerHTML = "";
	returnImg();
}

function rotateFunc (awards,angle,text){
	jQuery('#lotteryBtn').stopRotate();
	jQuery("#lotteryBtn").rotate({
		angle:0, 
		duration: 5000, 
		animateTo: angle+2880, //angle是图片上各奖项对应的角度，1440是我要让指针旋转4圈。所以最后的结束的角度就是这样子^^
		callback:function(){
			showGiftGetBlock(text);
		}
	}); 
}
function freshDraw(type,obj){

    jQuery("a[name='whoWin']").removeClass("cur");
    jQuery(obj).addClass("cur");

    var url  ="/active/drawData.do?type="+type+"&random="+Math.round(Math.random()*100);
    jQuery("#prizeDivList").load(url,null,function (data){
        if(jQuery("#prizeTimeList").find("li").length > 6){
            startmarquee(35,20,500,"prizeTimeList");
        }
    });
}
function freshDraw2(type,obj){
	jQuery("a[name='whoWin']").removeClass("cur");
	jQuery(obj).addClass("cur");

	if(type==1){
		jQuery("#prizeTimeDivList").show();
		jQuery("#myGiftList").hide();
	}else{
		jQuery("#prizeTimeDivList").hide();
		jQuery("#myGiftList").show();
	}
}
var isclick=false;
function roundTurntable(){

    if(isclick){
        return;
    }
    isclick =true;
    var url = "/active/round.do?rand="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(data){
        isclick=false;

        if(data==-1){
            showlogin(0);
        }else if(data == -2){
            showGiftGetBlock(jsNoChanceToday+"<br/>");
            jQuery("#goToFuturesTrading").show();
            document.getElementById("iconCueImg").className = "iconCue iconCue1";
        }else if(data == -3){
            showGiftGetBlock(jsFinisRoateToday);
            jQuery("#goToFuturesTrading").hide();
            document.getElementById("iconCueImg").className = "iconCue iconCue1";
        }else if(data == 1){
            rotateFunc(2,292.5,"恭喜你！<br/>获得神秘大奖");
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==2){
            rotateFunc(2,112.5,activeiphone6);
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==3){
            rotateFunc(3,67.5,"恭喜你！<br/>获得xbox");//xbox
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==4){
            rotateFunc(3,247.5,"恭喜你！<br/>获得红米Note");//红米note
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==5){
            rotateFunc(3,337.5,"恭喜你！<br/>获得移动电源");//移动电源
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==6){
            rotateFunc(3,157.5,active1LTC);
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data==7){//0.1LTC
            rotateFunc(3,22.5,active01LTC);
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }else if(data == 8){
            rotateFunc(3,202.5,"恭喜你！<br/>获得0.1美刀");
            document.getElementById("iconCueImg").className = "iconCue iconCue3";
        }

        if(data>0){
            var isChance = Number(document.getElementById("isChance").innerHTML);
            document.getElementById("isChance").innerHTML = (isChance-1);

            var isUsed = Number(document.getElementById("isUsed").innerHTML);
            document.getElementById("isUsed").innerHTML = (isUsed+1);

            document.getElementById("drawTries").innerHTML =moreTries0;
        }


    });
}
//type =0 :获奖名单 type=1 我的奖品
function entrustGift(type){
	var currentPage = document.getElementById("activityCurrentPage").value;
	var url  ="/active/draw.do?type="+type+"&currentPage="+currentPage+"&random="+Math.round(Math.random()*100);
	jQuery("#pageDrawDiv").load(url,null,function (data){
	});
}

//function worldCupVote(matchId,name,result){
//	var url = "/active/worldCupVote.do?matchId="+matchId+"&result="+result+"&random="+Math.round(Math.random()*100);
//	document.getElementById("worldCupName").value = name;
//	var person = "#peopleStation1";
//	if(matchId == 3){
//		person = "#peopleStation2";
//	}else if(matchId == 4){
//		person = "#peopleStation3";
//	}
//	jQuery.post(url,null,function(data){
//		if(data==0){
//			var callback={okBack:function(){window.location.href= document.getElementById("coinMainUrl").value+"/active/worldCup.do";},noBack:function(){return false;}};
//			okcoinAlertNew("投票成功，谢谢支持！", matchId, name, null, callback, null);
////			showReturnCastVote(0);
//		}else if(data==-1){
//			showlogin(0);
//		}else if(data==-2){
//			//"该场次还没开始"
//			okcoinAlertNew("当次投票还没开始，谢谢支持！", matchId, name, null, null, null);
////			showReturnCastVote(-2);
//		}else if(data ==-3){
//			//投票已经结束
//			okcoinAlertNew("当次投票已经结束啦，谢谢支持！", matchId, name, null, null, null);
////			showReturnCastVote(-3);
//		}else if(data ==-4){
//			okcoinAlertNew("已经投过票啦，谢谢支持！", matchId, name, null, null, null);
////			showReturnCastVote(-4);
//		}
//	});
//}

function sendWeibo(amount,matchId,name,code,type){
	var url = document.getElementById("worldCupUrl").value;
	var mostGoal = document.getElementById("mostCupUserNum").value
	var desc;
	if(matchId != -1){
		var std = "worldCupCastResult"+matchId;
		var str = document.getElementById(std).value;
		if(type == 2 && str == 1){
			amount = document.getElementById("worldCupCastHomeName"+matchId).value;
		}else if(type == 2 && str == 2){
			amount = document.getElementById("worldCupCastAwayName"+matchId).value;
		}else{
			amount = name;
		}
	}
	
//	url += code;
	var pic = '';
	if(type==1){
		desc = '哎呦不错喔～ 在#我是世界杯预测帝#活动中，我已得到'+amount+'分，目前预测帝得'+mostGoal+'分。小伙伴们一起来 @OKCoin比特币 ，争做预测帝，免费得1比特币和 @SF银鱼矿机 刀片矿机 [给力]，参与和转发微博都有68coin.com提供的彩票拿，走你～';
	}else if(type == 2){
		desc =  '有点意思哇！在#我是世界杯预测帝#活动中，我支持了'+amount+'，轻松一注彩票到手 。一起来 @OKCoin比特币 参加吧，预测帝可免费得1比特币和 @SF银鱼矿机 刀片矿机[给力]，参与和转发微博的小伙伴都有68coin.com提供的彩票拿，走你～';
	}else if(type == 3){
		desc =  registeringaccount;
		pic = document.getElementById("codeSpanPreUrl").value+'/image/active/okcoin_future_active.jpg';
	}else{
		desc =  '太给力了！在#我是世界杯预测帝#活动中，我成功预测'+amount+'小组赛得胜方，得'+code+'分 [哈哈]目前预测帝得'+mostGoal+'分。伙伴们一起来 @OKCoin比特币 ，争做预测帝，免费得1比特币和 @SF银鱼矿机 刀片矿机 [给力]，参与和转发微博都有68coin.com提供的彩票拿，走你～';
	}
//	var codeSpanPreUrl = document.getElementById("codeSpanPreUrl").value;
	var p = {
		url:url, /*获取URL，可加上来自分享到QQ标识，方便统计*/
		desc:'', /*分享理由(风格应模拟用户对话),支持多分享语随机展现（使用|分隔）*/
		title:desc, /*分享标题(可选)*/
		summary:'', /*分享摘要(可选)*/
//		pic:codeSpanPreUrl+'/image/wap_luck/weibopic1.jpg?1'+'||'+codeSpanPreUrl+'/image/wap_luck/logo.jpg'+'||'+codeSpanPreUrl+'/image/wap_luck/weibopic2.jpg', /*分享图片(可选)*/
		pic:pic, /*分享图片(可选)*/
		flash: '', /*视频地址(可选)*/
		site:'', /*分享来源(可选) 如：QQ分享*/
		style:'102', 
		width:63,
		height:24
	};
	var s = [];
	for(var i in p){
		s.push(i + '=' + encodeURIComponent(p[i]||''));
	}
	var openurl = "http://service.weibo.com/share/share.php?"+s.join('&');
	window.open(openurl);
}
function sendToSeas(type){
	var url = document.getElementById("worldCupUrl").value;
	var openurl = "";
	if(type==1){//分享到facebook
		openurl = "http://www.facebook.com/sharer.php?u="+url;
	}else if(type==2){//分享到twitter
		openurl = "http://twitter.com/home/?status="+url;
	}
	
	window.open(openurl);
}

function sendQQ(type){
		var url = document.getElementById("worldCupUrl").value;
		var desc;
		var pic = '';
		if(type ==1){
			desc =  registeringaccount;
			pic = document.getElementById("codeSpanPreUrl").value+'/image/active/okcoin_future_active.jpg';
		}
		var p = {
			url:url, /*获取URL，可加上来自分享到QQ标识，方便统计*/
			desc:desc, /*分享理由(风格应模拟用户对话),支持多分享语随机展现（使用|分隔）*/
			title:'邀请好友注册交易，海量反馈', /*分享标题(可选)*/
			summary:'我在OKCOin，邀请你成为我的好友，和我及另外一些不错的朋友们一起讨论比特币！', /*分享摘要(可选)*/
			pics:pic, /*分享图片(可选)*/
			flash: '', /*视频地址(可选)*/
			site:'', /*分享来源(可选) 如：QQ分享*/
			style:'102',
			width:63,
			height:24
		};
		var s = [];
		for(var i in p){
			s.push(i + '=' + encodeURIComponent(p[i]||''));
		}
		var openurl = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"+s.join('&');
		window.open(openurl);
}
function sendWeixin(type){
	if(document.getElementById("output").style.display=="none") {
		document.getElementById("output").style.display="";
//        jQuery("#output").fadeIn();
    }else {
        document.getElementById("output").style.display="none";
//    	jQuery("#output").fadeOut();
    }
	
}

function initclip(copyclickid,copytextid) {
	if(navigator.userAgent.indexOf("MSIE")>0){
		jQuery('#'+copyclickid).click(function(){
			window.clipboardData.setData("Text", jQuery('#'+copytextid).val());
		});
	}else{
		jQuery('#'+copyclickid).zclip({
			path:'/js/jquery/ZeroClipboard.swf',
			copy:jQuery('#'+copytextid).val()
		});
	}
}
function sendWeixinFriend(){
	dialogBoxShadowMove(false);
	document.getElementById("WeiXinLayer").style.display="block";
	addMoveEvent("dialog_title","dialog_content");
}
function closeWechat(tag){
	dialogBoxHidden();
	document.getElementById('WeiXinLayer').style.display = 'none';
}
function okcoinAlertNew(str,matchId,name,pro,callback,btnTitle) {
	/*
	*@str 传入提示内容
	*@pro 可选，取消按钮
	*返回值，确定为true，取消和关闭都为false
	*/
		if(btnTitle == "" || btnTitle == "undefined" || btnTitle==null){
			btnTitle = oksure;
		}
		var d = document, obj , tempStr = [] , dEle = d.documentElement , ieSix = (!window.XMLHttpRequest);
		var callback=callback||{okBack:function(){return true;},noBack:function(){return false;}};
		function gid(id){return d.getElementById(id);}
		if(!!gid("okcoinAlert")){		
			d.body.removeChild(gid("okcoinAlert"));
		}
		obj = d.createElement("div");	
		obj.className="okcoinPop";
		obj.id="returnCastVote";	
		
		tempStr.push('<div class="castVoteBody" id="castVoteBody">');
		tempStr.push('<a id="castVoteClosed" class="castVote_closed" href="javascript:void(0);"></a>');
		tempStr.push('<span class="castVoteResult" id="castVoteResult">'+str+'</span>');
		tempStr.push('<a class="castVoteButton castVoteButtonOne" id="castVoteButtonOk">确定</a>');
		tempStr.push('<a class="castVoteButton castVoteButtonTwo" id="castVoteButtonShare" target="_blank"onclick="javascript:sendWeibo(1,'+matchId+',\''+name+'\',0,2)">分享到新浪微博</a>');
		tempStr.push('</div>');
		obj.innerHTML=tempStr.join("");
		d.body.appendChild(obj);
		dialogBoxShadow();
		var os = obj.style;
		os.display="block";
		var temptop = d.body.scrollTop+d.documentElement.scrollTop;
		os.left=(dEle.clientWidth-obj.clientWidth)/2+dEle.scrollLeft+"px"; 	
		os.top=(dEle.clientHeight-obj.clientHeight)/2+dEle.scrollTop+d.body.scrollTop+"px";	
		if(ieSix){os.top=(dEle.clientHeight-obj.clientHeight)/2+temptop+"px";}
		os.position ="absolute";
		os.zIndex="100000";
		function fixed(){
			os.top=(dEle.clientHeight-obj.clientHeight)/2+dEle.scrollTop+d.body.scrollTop+"px";			
		}		
		if(ieSix){
			addEV(window,"scroll",fixed);
		}else{
			addEV(window,"scroll",fixed);
		}
		function hideObj(){
			d.body.removeChild(obj);
			dialogBoxHidden();
			os.display="none";
			if(ieSix){
				window.detachEvent("onscroll",fixed);
			}
		}		
		gid("castVoteClosed").onclick=function(){
			hideObj();
			if(!!callback.noBack){
				callback.noBack();
			}
			return false;
		};
		gid("castVoteButtonOk").onclick=function(){
			hideObj();
			if(!!callback.okBack){
				callback.okBack();
			}
			return true;
		};
		return true;
	}
function applyForActive(){
	var url = "/hd/submitParticipate.do?random="+Math.round(Math.random()*100);
	var phone = trim(document.getElementById("applyPhone").value);
	var name = trim(document.getElementById("applyName").value);
	var areaCode = document.getElementById("applyAreaCode").value;
	document.getElementById("applyErrorTips").innerHTML = "";
	if(name == ""){
		document.getElementById("applyErrorTips").innerHTML = "请输入您姓名";
		return;
	}
	if(phone == ""){
		document.getElementById("applyErrorTips").innerHTML = "请输入您的手机号";
		return;
	}
	var param={phone:phone,name:name,areaCode:areaCode};
	jQuery.post(url,param,function(data){
		if(data > 0){
			document.getElementById("applyForActiveBlock").innerHTML = "";
			var callback={okBack:function(){window.location.href= document.getElementById("coinMainUrl").value+"/hd/participate.do";},noBack:function(){return false;}};
			okcoinAlert("恭喜您报名成功",null,callback,"确定");
		}else if(data == -1){
			document.getElementById("applyErrorTips").innerHTML = "手机号输入不合法";
		}else if(data == -2){
			document.getElementById("applyErrorTips").innerHTML = "手机号已存在";
		}else if(data == -3){
			document.getElementById("applyErrorTips").innerHTML = "您的姓名输入不合法";
		}
	});
}

function showApplyPopBlock(){
	dialogBoxShadow();
	document.getElementById("applyForActiveBlock").style.display = "block";
}
function closeApplyPopBlock(){
	dialogBoxHidden();
	document.getElementById("applyForActiveBlock").style.display = "none";
}

//控制api中链接的展开和隐藏
jQuery(".api_rightBody .apiTable a").click(function(){
	var $describe = jQuery(this).parent().find(".describeDiv");
	if($describe.css("display") == "none"){
		jQuery(this).addClass("open");
		$describe.show();
	}else{
		$describe.hide();
		jQuery(this).removeClass("open");
	}
});
//控制security中链接的展开和隐藏
jQuery(".thirdPart span").click(function(){
	var $describe = jQuery(this).parent().find(".thirdCont");
	if($describe.css("display") == "none"){
		jQuery(this).addClass("thirdTitleSelected");
		$describe.show();
	}else{
		$describe.hide();
		jQuery(this).removeClass("thirdTitleSelected");
	}
});
/*****新年砸蛋*****/
var mainPre=!document.getElementById("preUrl_get")?"":document.getElementById("preUrl_get").value;
function changeImg(activeNum){
//	document.getElementById("eggsImg").setAttribute("src",mainPre+"/image/active/newYear/egg.gif");
//	jQuery("#eggsImg").css({
//	    width:590+"px",
//	    height:500+"px",
//	    top:-227+"px",
//	    left:250+"px"
//	});
	
	//图片和样式替换
	jQuery("#eggsImg").attr({
		"src":mainPre+"/image/active/egg/egg.gif"
	});
	
	mmove=setTimeout(function(){
		//showGiftGetBlock(1);
        breakEgg(activeNum);
	},450);
}

function returnImg(){
	//jQuery("#eggsImg").css({
	//    width:342+"px",
	//    height:436+"px",
	//    top:-180+"px",
	//    left:340+"px"
	//});
	document.getElementById("eggsImg").setAttribute("src",mainPre+"/image/active/egg/egg_still.jpg");
}

function changeImg2(type){
	//图片和样式替换
	if(type==5){
		jQuery("#goldenImgIn").removeClass("goldenImg_in").addClass("goldenImg_over");
	}else if(type==6){
		jQuery("#eggsImgIn").removeClass("eggsImg_in").addClass("eggsImg_over");
	}
	mmove=setTimeout(function(){
		//showGiftGetBlock(1);
		breakEgg2(type);
	},450);
}
function returnImg2(type){
	if(type==5){
		document.getElementById("goldenEggsImg").setAttribute("src",mainPre+"/image/active/egg/egg_still.jpg");
	}else if(type==6){
		document.getElementById("easterEggsImg").setAttribute("src",mainPre+"/image/active/egg/egg_still.jpg");
	}
}
function changeImg3(){

    //图片和样式替换
    jQuery("#eggsImg").attr({
        "src":mainPre+"/image/active/egg/egg.gif"
    });

    mmove=setTimeout(function(){
        //showGiftGetBlock(1);
        breakEgg3();
    },450);
}

var hahaArray = new Array();
hahaArray.push("安静的美男子封号");
hahaArray.push("金正恩的香吻一个");
hahaArray.push("OKCoin的加班餐一份");
hahaArray.push("中本聪的保佑");
hahaArray.push("奥巴马的爱慕");
hahaArray.push("徐明星的熊抱");
hahaArray.push("泷泽萝拉的媚眼一个");
hahaArray.push("考试不挂科法力");
hahaArray.push("隐形护身符");
hahaArray.push("苍井空爱抚");
hahaArray.push("何一对你的祝福");
hahaArray.push("葵花宝典一部");
hahaArray.push("帅到没朋友奖状");
hahaArray.push("林志玲爱的抱抱");
hahaArray.push("王思聪的么么哒");
hahaArray.push("客户总监手绘画一幅");
hahaArray.push("英雄联盟防坑券");
hahaArray.push("OKCoin一日游套餐");
hahaArray.push("一天的好心情");

function alertEgg(eggNum,times){
    if(eggNum == 0){
        // 没有砸蛋次数
        jQuery(".getOtherGiftBody").show();
        jQuery("#goRecharge").hide();
        showGiftGetBlock("<p>抱歉！</p>"+"您还没有砸蛋机会<br/>");
    }else if(times == 0){
        // 没有砸蛋次数
        jQuery(".getOtherGiftBody").show();
        jQuery("#goRecharge").hide();
        showGiftGetBlock("<p>抱歉！</p>"+"您的砸蛋机会已经用光了<br/>");
    }
}

function breakEgg(activeNum){

    if(isclick){
        return;
    }
    isclick =true;
    var url = "/active/lottery_12.do?rand="+Math.round(Math.random()*100)+"&activeNum="+activeNum;
    jQuery.post(url,null,function(data){
        isclick=false;
        var resultDate = eval('(' + data + ')');
        if(resultDate == null){
           return ;
        }

        jQuery("#goRecharge").hide();

        var result = resultDate.result ;

        if(result == 501){
        	// 登录失效
            showlogin(0);
        }else if(result == 502){
        	// 非活动用户
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"您不能参与本次活动<br/>");
        }else if(result == 503){
        	// 没有砸蛋次数
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"您还没有砸蛋机会<br/>");
        }else if(result == 504){
            // 没有砸蛋次数
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"您的砸蛋机会已经用光了<br/>");
        }else if(result == 505){
        	// 活动结束
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"本次活动已经结束了<br/>");
        }else if(result == 510){
        	// 抽奖失败
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"抽奖失败<br/>");
        }else if(result == 0){
        	// 抽奖成功
        	var prize = resultDate.prize;
        	jQuery(".getOtherGiftBody").show();
        	jQuery("#goRecharge").hide();
        	showGiftGetBlock("<p>恭喜你！</p>"+"获得"+prize+"<br/>");
        }else{
            window.location.href=document.getElementById("coinMainUrl").value;
        }
    });

}
/**
 * 砸金蛋 2016.7.11活动
 */
function breakEgg2(activityNum){

    if(isclick){
        return;
    }
    isclick =true;
    
    if(activityNum!=15&&activityNum!=16){
    	return;
    }
    var url = "/active/lottery_15.do?activityNum="+activityNum+"&rand="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(data){
        isclick=false;
        var result = eval('(' + data + ')');
        if(result == null){
           return ;
        }

        jQuery("#goRecharge").hide();

        var type = result.type ;

        if(type==-10){
            showlogin(0);//登录
        }else if(type == -1){
        	// 已经抽奖了
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>恭喜你！</p>"+"您已经抽过奖了<br/>");
        }else if(type == -2){
        	// 未充值够5000
            showGiftGetBlock("");
            jQuery(".getOtherGiftBody").hide();
            jQuery("#goRecharge").show();
        }else if(type == -3 || type == -4 || type == -5 || type == -6){
        	// 抽奖失败
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>非常抱歉！</p>"+"抽奖失败<br/>");
        }else if(type == -11 || type == -12){
        	// 老用户、参数错误
        	jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>非常抱歉！</p>"+"抽奖失败<br/>");
        }else if(type>0 && type <=7){
        	var prize = result.prize ;
        	jQuery(".getOtherGiftBody").show();
        	jQuery("#goRecharge").hide();
        	showGiftGetBlock("<p>恭喜你！</p>"+"获得"+prize+"<br/>");
        }
    });

}

/**
 * 2016.6.22 充值砸金蛋活动 ----未上线
 */
function breakEgg3(){

    if(isclick){
        return;
    }
    isclick =true;
    var url = "/active/lottery_14.do?rand="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(data){
        isclick=false;
        var resultDate = eval('(' + data + ')');
        if(resultDate == null){
            return ;
        }

        jQuery("#goRecharge").hide();

        var result = resultDate.result ;

        if(result == 501){
            // 登录失效
            showlogin(0);
        }else if(result == 502){
            // 非活动用户
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"您不能参与本次活动<br/>");
        }else if(result == 503){
            // 已经抽奖了
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"您已经抽过奖了<br/>");
        }else if(result == 504){
            // 没有抽奖资格 没充值够1000
            showGiftGetBlock("");
            jQuery(".getOtherGiftBody").hide();
            jQuery("#goRecharge").show();
        }else if(result == 505){
            // 活动结束
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"本次活动已经结束了<br/>");
        }else if(result == 510){
            // 抽奖失败
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>抱歉！</p>"+"抽奖失败<br/>");
        }else if(result == 0){
            // 抽奖成功
            var prize = resultDate.prize;
            jQuery(".getOtherGiftBody").show();
            jQuery("#goRecharge").hide();
            showGiftGetBlock("<p>恭喜你！</p>"+"获得"+prize+"<br/>");
        }else{
            window.location.href=document.getElementById("coinMainUrl").value;
        }
    });

}

var ticketCount = 0 ;
function getTicket(){

    var user_code = jQuery("#user_code").val();
    var code = jQuery("#ticketCode").val();
    var url = "/active/getTicker.do?rand="+Math.round(Math.random()*100);
    var param={user_code:user_code,code:code};
    if(ticketCount != 0){
        return ;
    }
    ticketCount = 1 ;
    jQuery("#user_code").val("");
    jQuery.post(url,param,function(data){
        ticketCount = 0 ;
        closeGiftGetBlock();


    });




}

/**
 * 签到活动 签到
 */
function signInSubmit() {
    var isMobile = document.getElementById("isMobile").value;
    var url = "/active/signInSubmit.do?rand="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultObj){
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }

        if(result == -1){
            // 请求错误，跳到首页
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -2){
            // 活动结束
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -3){
            // 登录失效
            //alert("登录失效");
            if(isMobile==0) {
                window.location.href = document.getElementById("coinMainUrl").value+"/user/login.do?forward=%2Factive%2FsignInPage.do";
            }else{
                window.location.href = document.getElementById("coinMainUrl").value+"/mobile/showLogin.do?forward=%2Factive%2FsignInMobile.do";
            }
        }else if(result == -4){
            // 重复签到
            //alert("重复签到");
            if(isMobile==0) {
                showDialogBoxShadow(1,"签到虽好，可不要贪签哦~");
            }else{
                showDialogBoxShadow(1,"您已经签到了哦");
            }
            setClosePopEvent("window.location.reload()");
        }else if(result == 0){
            // 签到成功
            var activeTimes = resultObj.activeTimes;// 抽奖次数
            //alert("签到成功");
            if(isMobile==0) {
                window.location.reload();
            }else{
                showDialogBoxShadow(1,"<p>签到成功</p><em>恭喜您获得<i>"+activeTimes+"</i>次抽奖机会</em>");
                setClosePopEvent("window.location.reload()");
            }
        }else if(result == 1){
            // 签到成功，且有礼品
            var type = resultObj.type;// 中奖类型
            var prize = resultObj.prize;// 奖品
            var activeTimes = resultObj.activeTimes;// 抽奖次数
            //alert("签到成功，获得礼品"+prize);
            if(isMobile==0) {
                showDialogBoxShadow(11,"恭喜您获得<em>"+prize+"</em><i>免息券可以在融资融币页面查看和使用</i>");
            }else{
                showDialogBoxShadow(2,"<p>签到成功<em>恭喜您获得<i>"+activeTimes+"</i>次抽奖机会</em>"+prize+"</p>");
            }
            setClosePopEvent("window.location.reload()");
        }else{
            // 签到失败
            window.location.reload();
        }
    }, "json");
}

/**
 * 签到活动 抽奖
 */
function signInWheel() {
    var isMobile = document.getElementById("isMobile").value;
    var isWheeling = document.getElementById("isWheeling").value;
    if(isWheeling == 1) {
        return ;
    }
    document.getElementById("isWheeling").value = 1;
    // 发送抽奖请求
    var url = "/active/lottery_17.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultObj){
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }
        //alert("resultData:" + resultData);

        if(result == 0){

            var animateTo = 360 * 10;
            if(result==0) {
                var type = resultObj.type;// 中奖类型
                animateTo = animateTo + (11-type) * 36;
            }

            // 转盘
            jQuery("#drawPointer").rotate({
                angle:0,
                duration: 8000,
                animateTo: animateTo,
                callback:function(){
                    // 抽奖结果
                    if(result==0) {
                        // 抽奖成功
                        var id = resultObj.id;// 记录id
                        var type = resultObj.type;// 中奖类型
                        var prize = resultObj.prize;// 奖品
                        var classify = resultObj.classify;// 奖品分类

                        if(isMobile==0) {
                            if(id>0 && classify>0) {
                                if(classify==5) {
                                    // 实物
                                    //document.getElementById("word").innerHTML = "<P>恭喜您</p><em>恭喜您获得了"+prize+"。请填写你的收获地址，我们随后就会给您邮递过去！</em>";
                                    showAdd(id, prize);// 地址弹层会重置确定按钮的跳转
                                }else if(classify==1) {
                                    showDialogBoxShadow(11,"恭喜您抽中<em>"+prize+"</em><i>免息券可以在融资融币页面查看和使用</i>");
                                    setClosePopEvent("window.location.reload()");
                                }else if(classify==4) {
                                    showDialogBoxShadow(12,"恭喜您抽中<em>"+prize+"</em><i>奖励的"+prize+"已经存入您的账户</i>");
                                    setClosePopEvent("window.location.reload()");
                                }
                            }else {
                                // 抽奖失败
                                showDialogBoxShadow(0,"很遗憾，您没有抽中~");
                                setClosePopEvent("window.location.reload()");
                            }
                        }else {
                            if(id>0 && classify>0) {
                                var popType = classify == 1 ? 11 : classify == 4 ? 12 : classify == 5 ? 13 : 0;
                                showDialogBoxShadow(popType,"恭喜您抽中<em>"+prize+"</em>");
                            }else {
                                // 抽奖失败
                                showDialogBoxShadow(0,"很遗憾，您没有抽中~");
                            }
                            setClosePopEvent("window.location.reload()");
                        }
                    }
                    document.getElementById("isWheeling").value = 0;
                }
            });
        }else {
            if(result == -1){
                // 请求错误，跳到首页
                window.location.href=document.getElementById("coinMainUrl").value;
            }else if(result == -2){
                // 活动结束
                if(isMobile==0) {
                    showDialogBoxShadow(0,"很遗憾，活动已经结束");
                }else{
                    showDialogBoxShadow(0,"很遗憾，活动已经结束");
                }
                setClosePopEvent("window.location.reload()");
            }else if(result == -3){
                //未登录
                if(isMobile==0) {
                    window.location.href = document.getElementById("coinMainUrl").value+"/user/login.do?forward=%2Factive%2FsignInPage.do";
                }else{
                    window.location.href = document.getElementById("coinMainUrl").value+"/mobile/showLogin.do?forward=%2Factive%2FsignInMobile.do";
                }
            }else if(result == -4){
                // 尚未签到
                if(isMobile==0) {
                    showDialogBoxShadow(0,"请先签到");
                }else{
                    showDialogBoxShadow(0,"请先签到");
                }
            }else if(result == -5){
                // 没有抽奖机会
                if(isMobile==0) {
                    showDialogBoxShadow(0,"抽奖机会用光啦~");
                }else{
                    showDialogBoxShadow(0,"很遗憾<i>您今天已经没有机会了</i>");
                }
                setClosePopEvent("window.location.reload()");
            }else{
                // 抽奖失败
                if(isMobile==0) {
                    showDialogBoxShadow(0,"抱歉，抽奖失败~");
                }else{
                    showDialogBoxShadow(0,"抱歉，抽奖失败~");
                }
                setClosePopEvent("window.location.reload()");
            }
            document.getElementById("isWheeling").value = 0;
        }

    }, "json");
}

/**
 * 签到活动 填写、修改收获信息
 */
function signInReceiveInfo() {
	var isMobile = document.getElementById("isMobile").value;
    var id = document.getElementById("awardId").value;
    var receiveUser = document.getElementById("receiveUser").value;
    var receivePhone = document.getElementById("receivePhone").value;
    var receiveAddress = document.getElementById("receiveAddress").value;
    if(id<=0) {
        window.location.reload();
        return ;
    }
    if(receiveUser=="") {
        showReceiveTips("请填写收货人姓名");
        return ;
    }
    if(receiveUser.length>100) {
        //alert("收货人姓名过长");
        showReceiveTips("收货人姓名过长");
        return ;
    }
    if(receivePhone=="") {
        //alert("请填写联系电话");
        showReceiveTips("请填写收件人电话");
        return ;
    }
    //if(receivePhone.length>100) {
    //    alert("联系电话过长");
    //    return ;
    //}
    if(!checkMobile(receivePhone)){
        //alert("联系电话不合法");
        showReceiveTips("请检查您填写手机号码");
        return ;
    }
    if(receiveAddress=="") {
        //alert("请填写收货地址");
        showReceiveTips("请填写收件地址");
        return ;
    }
    if(receiveAddress.length>255) {
        //alert("收货地址过长");
        showReceiveTips("收件地址过长");
        return ;
    }
    var url = "/active/signInReceiveInfo.do?rand="+Math.round(Math.random()*100);
    var param = {id:id,receiveUser:receiveUser,receivePhone:receivePhone,receiveAddress:receiveAddress};
    jQuery.post(url,param,function(result){

        if(result == -1){
            // 请求错误，跳到首页
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -2){
            // 活动结束
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -3){
            // 登录失效
            window.location.href = document.getElementById("coinMainUrl").value+"/user/login.do?forward=%2Factive%2FsignInPage.do";
        }else if(result == -4){
            // 参数错误
            //alert("参数错误");
            showReceiveTips("收件信息有误，请检查");
        }else if(result == 0){
            // 请求成功
			if(isMobile==0){
				showReceiveTips("提交成功");
                // 刷新页面
				setTimeout("location.reload([true]) ",1000);
			}else {
                // 确认领取信息
                showReceiveInfo();
			}
        }else{
            // 请求失败
            window.location.href=document.getElementById("coinMainUrl").value;
        }
    });
}

/**
 * 中秋活动 之 融资领免息券
 */
jQuery(".getCoupon").click(function(){
	var couponType = jQuery(this).attr("value");
    var isMobile = document.getElementById("isMobile").value;
	var param={couponType:couponType};
	// 发送抽奖请求
	var url = "/active/lottery_20.do?random="+Math.round(Math.random()*100);
	jQuery.post(url,param,function(resultData){
		var resultObj = eval('(' + resultData + ')');
		var result = 0;
		if(resultObj!=null){
			result = resultObj.result;
		}else{
			result = -100;
		}
		var prize = 0;
		if(result == 0){
			// 抽奖成功
			var type = resultObj.type;// 中奖类型
			prize = resultObj.prize;// 奖品
			// 抽奖成功
			document.getElementById("word").innerHTML = "<P>恭喜您</p><em>恭喜您获得了"+prize+"！</em>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			showDialogBoxShadow();
			/*alert("恭喜您恭喜您获得了"+prize);*/
		}else if(result == -1){
			// 请求错误，跳到首页
			window.location.href=document.getElementById("coinMainUrl").value;
		}else if(result == -2){
			// 活动结束
			document.getElementById("word").innerHTML = "<p>抱歉，活动已经结束</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			showDialogBoxShadow();
			/*alert("抱歉，活动已经结束");*/
		}else if(result == -3){
			//未登录
			document.getElementById("word").innerHTML = "<p>抱歉，您尚未登录</p>";
			document.getElementById("popBtn").innerHTML = "确定";
            var loginUrl = "/user/login.do";
            if(isMobile == 1) {
                loginUrl = "/mobile/showLogin.do";
            }
            document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
			showDialogBoxShadow();
		}else if(result == -4){
			// 已经领过该免息券
			prize = resultObj.prize;// 奖品
			document.getElementById("word").innerHTML = "<p>您已成功获得过"+prize+"！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
			/*alert("您已成功获得过"+prize+"！");*/
		}else if(result == -5){
			// 不符合条件
			document.getElementById("word").innerHTML = "<p>您还没有达到领取条件，赶紧去融资吧！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/lend/borrows.do";
            if(isMobile == 1) {
                document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
            }
			showDialogBoxShadow();
			/*alert("您还没有达到领取条件，赶紧去融资吧！");*/
		}else{
			// 抽奖失败
			document.getElementById("word").innerHTML = "<p>非常抱歉，领奖失败</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
			/*alert("非常抱歉，领取失败");*/
		}
	});
});


/**
 * 中秋充值
 */
function moonFestivalWheel() {
    var isMobile = document.getElementById("isMobile").value;
    var isRotating = document.getElementById("isRotating").value;
    if(isRotating==1) {
        return ;
    }

    document.getElementById("isRotating").value = 1;// 转盘没转完不能再点
    // 发送抽奖请求
    var url = "/active/lottery_21.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultData){
        var resultObj = eval('(' + resultData + ')');
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }

        if(result == 0){
            // 抽奖成功
            var type = resultObj.type;// 中奖类型
            var prize = resultObj.prize;// 奖品

            // 抽奖成功
            document.getElementById("word").innerHTML = "<P>恭喜您!</p><em>成功获得"+prize+"</em>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";

            // 转盘
            jQuery(".award").rotate({
                angle:0,
                duration: 8000,
                animateTo: (7-type)*60+360*10,
                callback:function(){
                    // 修改抽奖机会
                    var finChances = document.getElementById("finChances").value;
                    finChances = finChances - 1;
                    if(finChances<0) {
                        finChances = 0;
                    }
                    document.getElementById("finChances").value = finChances;
                    document.getElementById("finChancesEm").innerText = finChances;

                    // 抽奖结果
                    showDialogBoxShadow();
                    document.getElementById("isRotating").value = 0;

                    // 刷新实时获奖数据
                    if(document.getElementById("isMobile").value==0) {
                        moonFestivalFinActiveListDiv();
                    }
                }
            });

        }else {
            if(result == -1){
                // 请求错误，跳到首页
                window.location.href=document.getElementById("coinMainUrl").value;
            }else if(result == -2){
                // 活动结束
                document.getElementById("word").innerHTML = "<p>抱歉，活动已经结束</p>";
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value;
                showDialogBoxShadow();
            }else if(result == -3){
                //未登录
                document.getElementById("word").innerHTML = "<p>抱歉，您尚未登录</p>";
                document.getElementById("popBtn").innerHTML = "确定";
                var loginUrl = "/user/login.do";
                if(isMobile == 1) {
                    loginUrl = "/mobile/showLogin.do";
                }
                document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
                showDialogBoxShadow();
            }else if(result == -4){
                // 没有抽奖机会
                document.getElementById("word").innerHTML = "<p>您现在没有抽奖机会，赶紧去充值吧！</p>";
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/account/rechargeCny.do";
                if(isMobile == 1) {
                    document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
                }
                showDialogBoxShadow();
            }else{
                // 抽奖失败
                document.getElementById("word").innerHTML = "<p>非常抱歉，抽奖失败</p>";
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
                showDialogBoxShadow();
            }
            document.getElementById("isRotating").value = 0;
        }
    });
}

/**
 * 刷新中秋充值中奖数据
 */
function moonFestivalFinActiveListDiv() {
    var url = "/about/moonFestivalFinActiveListDiv.do?random"+Math.round(Math.random()*100);
    var lastNum = jQuery("#finActiveList").find("li").length;
    jQuery("#finActiveListDiv").load(url,null,function (data){
        //当取出来的数据大于3条是滚动显示冠军榜信息
        if(lastNum <= 3 && jQuery("#finActiveList").find("li").length > 3){
            startmarquee2(35,20,500,"finActiveListDiv");
        }
    });
}

/**
 * 十月狂欢 充值送金账户
 */
function lottery_23() {
    var isMobile = document.getElementById("isMobile").value;
    var url = "/active/lottery_23.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultObj){
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }
        var prize = "";
        if(result == 0){
            // 抽奖成功
            var type = resultObj.type;// 中奖类型
            prize = resultObj.prize;// 奖品
            // 抽奖成功
            document.getElementById("word").innerHTML = "<P>恭喜您获得了</p><em>"+prize+"！</em>";
            if(isMobile == 0) {
                document.getElementById("popBtn").innerHTML = "查看";
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/account/score.do";
            }else{
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href = "javascript:window.location.reload();";
            }
            showDialogBoxShadow();
            /*alert("恭喜您恭喜您获得了"+prize);*/
        }else if(result == -1){
            // 请求错误，跳到首页
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -2){
            // 活动结束
            document.getElementById("word").innerHTML = "<p>抱歉，活动已经结束</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
            /*alert("抱歉，活动已经结束");*/
        }else if(result == -3){
            //未登录
            document.getElementById("word").innerHTML = "<p>抱歉，您尚未登录</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            var loginUrl = "/user/login.do";
            if(isMobile != 0) {
                loginUrl = "/mobile/showLogin.do";
            }
            document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
            showDialogBoxShadow();
        }else if(result == -4){
            // 已经领过该免息券
            prize = resultObj.prize;// 奖品
            document.getElementById("word").innerHTML = "<p>您已领取过金账户，不能重复领取哦！</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
            /*alert("您已成功获得过"+prize+"！");*/
        }else if(result == -5){
            // 不符合条件
            document.getElementById("word").innerHTML = "<p>您还没有达到领取条件，赶紧去充值吧！</p>";
            document.getElementById("popBtn").innerHTML = "充值";
            if(isMobile == 2) {
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/mobile/recharge.do";
            }else{
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/account/rechargeCny.do";
            }
            showDialogBoxShadow();
            /*alert("您还没有达到领取条件");*/
        }else{
            // 抽奖失败
            document.getElementById("word").innerHTML = "<p>非常抱歉，领奖失败</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
            /*alert("非常抱歉，领取失败");*/
        }
    }, "json");
}

/**
 * 十月狂欢 新手实名
 */
function lottery_24() {
    var isMobile = document.getElementById("isMobile").value;
    var url = "/active/lottery_24.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultObj){
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }
        var prize = "";
        if(result == 0){
            // 抽奖成功
            var type = resultObj.type;// 中奖类型
            prize = resultObj.prize;// 奖品
            // 抽奖成功
            document.getElementById("word").innerHTML = "<P>恭喜您获得了</p><em>"+prize+"！</em>";
            if(isMobile == 0) {
                document.getElementById("popBtn").innerHTML = "查看";
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/lend/borrows.do";
            }else{
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href = "javascript:window.location.reload();";
            }
            showDialogBoxShadow();
            /*alert("恭喜您恭喜您获得了"+prize);*/
        }else if(result == -1){
            // 请求错误，跳到首页
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -2){
            // 活动结束
            document.getElementById("word").innerHTML = "<p>抱歉，活动已经结束</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
            /*alert("抱歉，活动已经结束");*/
        }else if(result == -3){
            //未登录
            document.getElementById("word").innerHTML = "<p>抱歉，您尚未登录</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            var loginUrl = "/user/login.do";
            if(isMobile != 0) {
                loginUrl = "/mobile/showLogin.do";
            }
            document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
            showDialogBoxShadow();
        }else if(result == -4){
            // 老用户
            document.getElementById("word").innerHTML = "<p>此次活动只针对APP新用户哦！</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
            showDialogBoxShadow();
            /*alert("您已成功获得过"+prize+"！");*/
        }else if(result == -5){
            // 不符合条件
            document.getElementById("word").innerHTML = "<p>您还没有进行实名认证，快去认证吧！</p>";
            document.getElementById("popBtn").innerHTML = "实名认证";
            if(isMobile == 2) {
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/mobile/authentication.do";
            }else{
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/user/userinfo.do";
            }
            showDialogBoxShadow();
            /*alert("您还没有达到领取条件");*/
        }else if(result == -6){
            // 重复领取
            document.getElementById("word").innerHTML = "<p>您已经领取过该项福利了！</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
        }else{
            // 抽奖失败
            document.getElementById("word").innerHTML = "<p>非常抱歉，领取失败</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
            showDialogBoxShadow();
            /*alert("非常抱歉，领取失败");*/
        }
    }, "json");
}

/**
 * 十月狂欢 新手充值 判断体验金状态
 */
function lottery_25CheckExperienceGoldStatus() {
    var isMobile = document.getElementById("isMobile").value;
    var url = "/active/getExperienceGoldStatus.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(result){
        if(result == 0 || result == 1){
            // 未领奖、未归还
            var s = "<p>充值后将自动归还您领取的体验金</p>";
            if(result == 0){
                s = "<p>您尚未领取体验金，充值后将失去领取资格</p>";
            }
            document.getElementById("word").innerHTML = s;
            showDialogBoxShadow_chance();
        }else{
            // 已归还、不能领取
            if(isMobile == 2) {
                window.location.href = document.getElementById("coinMainUrl").value+"/mobile/recharge.do";
            }else{
                window.location.href = document.getElementById("coinMainUrl").value+"/account/rechargeCny.do";
            }
        }
    }, "json");
}

/**
 * 十月狂欢 新手充值
 */
function lottery_25() {
    var isMobile = document.getElementById("isMobile").value;
    var url = "/active/lottery_25.do?random="+Math.round(Math.random()*100);
    jQuery.post(url,null,function(resultObj){
        var result = 0;
        if(resultObj!=null){
            result = resultObj.result;
        }else{
            result = -100;
        }
        var prize = "";
        if(result == 0){
            // 抽奖成功
            var type = resultObj.type;// 中奖类型
            prize = resultObj.prize;// 奖品
            // 抽奖成功
            document.getElementById("word").innerHTML = "<P>恭喜您获得了</p><em>"+prize+"！</em>";
            if(isMobile == 0) {
                document.getElementById("popBtn").innerHTML = "查看";
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/account/record.do";
            }else{
                document.getElementById("popBtn").innerHTML = "确定";
                document.getElementById("popBtn").href = "javascript:window.location.reload();";
            }
            showDialogBoxShadow();
            /*alert("恭喜您恭喜您获得了"+prize);*/
        }else if(result == -1){
            // 请求错误，跳到首页
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result == -2){
            // 活动结束
            document.getElementById("word").innerHTML = "<p>抱歉，活动已经结束</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
            /*alert("抱歉，活动已经结束");*/
        }else if(result == -3){
            //未登录
            document.getElementById("word").innerHTML = "<p>抱歉，您尚未登录</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            var loginUrl = "/user/login.do";
            if(isMobile != 0) {
                loginUrl = "/mobile/showLogin.do";
            }
            document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
            showDialogBoxShadow();
        }else if(result == -4){
            // 老用户
            document.getElementById("word").innerHTML = "<p>此次活动只针对APP新用户哦！</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
            showDialogBoxShadow();
            /*alert("您已成功获得过"+prize+"！");*/
        }else if(result == -5){
            // 不符合条件
            document.getElementById("word").innerHTML = "<p>您还没有进行实名认证，快去认证吧！</p>";
            document.getElementById("popBtn").innerHTML = "实名认证";
            if(isMobile == 2) {
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/mobile/authentication.do";
            }else{
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/user/userinfo.do";
            }
            showDialogBoxShadow();
            /*alert("您还没有达到领取条件");*/
        }else if(result == -6){
            // 未充值
            document.getElementById("word").innerHTML = "<p>您还没有达到领取条件，赶紧去充值吧！</p>";
            document.getElementById("popBtn").innerHTML = "充值";
            if(isMobile == 2) {
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/mobile/recharge.do";
            }else{
                document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/account/rechargeCny.do";
            }
            showDialogBoxShadow();
            /*alert("您还没有达到领取条件");*/
        }else if(result == -7){
            // 重复领取
            document.getElementById("word").innerHTML = "<p>您已经领取过该项福利了！</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:window.location.reload();";
            showDialogBoxShadow();
        }else{
            // 抽奖失败
            document.getElementById("word").innerHTML = "<p>非常抱歉，领取失败</p>";
            document.getElementById("popBtn").innerHTML = "确定";
            document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
            showDialogBoxShadow();
            /*alert("非常抱歉，领取失败");*/
        }
    }, "json");
}

function loadOctoberRevelryTradeTop() {
    var url = "/about/octoberRevelryTradeTop.do";
    jQuery("#octoberRevelryTradeTop").load(url);
}

function loadOctoberRevelryTradeTimeTop() {
	var url = "/about/octoberRevelryTradeTimeTop.do";
	jQuery("#octoberRevelryTradeTimeTop").load(url);
}

function loadOctoberRevelryTradeMyTop() {
	var url = "/about/octoberRevelryTradeMyTop.do";
	jQuery("#octoberRevelryTradeMyTop").load(url);
}

/**
 * 十月狂欢 宝箱总动员
 */
function lottery_32(boxType) {
	var isMobile = document.getElementById("isMobile").value;
	//var boxType = jQuery(this).attr("value");
	var param={boxType:boxType};
	var url = "/active/lottery_32.do?random="+Math.round(Math.random()*100);
	jQuery.post(url,param,function(resultObj){
		var result = 0;
		if(resultObj != null){
			result = resultObj.result;
		}else{
			result = -100;
		}
		var prize = "";
		if(result == 0){
			// 抽奖成功
			var id = resultObj.prizeId;//
			var type = resultObj.prizeType;// 中奖类型
			prize = resultObj.prizeName;// 奖品
			// 抽奖成功
			if(type==5) {  // 实物
				//document.getElementById("word").innerHTML = "<P>恭喜您</p><em>恭喜您获得了"+prize+"。请填写你的收获地址，我们随后就会给您邮递过去！</em>";
				showAdd(id, prize);// 地址弹层会重置确定按钮的跳转
			}else if(type== 1 || type == 2 ) {
				document.getElementById("type1").innerHTML = "<P>恭喜您获得了</p><em>"+prize+"！</em>";
				document.getElementById("popBtn").innerHTML = "确定";
				document.getElementById("popBtn").href = "javascript:window.location.reload();";
				document.getElementById("dialog_closed").href = "javascript:window.location.reload();";
				showDialogBoxShadow();		/*alert("恭喜您恭喜您获得了"+prize);*/
			}
			jQuery(".btn").addClass(" disabled");
		}else if(result == -1){		// 请求错误，跳到首页
			window.location.href=document.getElementById("coinMainUrl").value;
		}else if(result == -2){		// 活动结束
			document.getElementById("type1").innerHTML = "<p>抱歉，当前不是活动时间</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();		/*alert("抱歉，活动已经结束");*/
		}else if(result == -3){		//未登录
			document.getElementById("type1").innerHTML = "<p>抱歉，您尚未登录</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			var loginUrl = "/user/login.do";
			if(isMobile != 0) {
				loginUrl = "/mobile/showLogin.do";
			}
			document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else if(result == -4){		// 已经开过
			document.getElementById("type1").innerHTML = "<p>您今天已经开过宝箱了！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			document.getElementById("dialog_closed").href = "javascript:window.location.reload();";
			showDialogBoxShadow();	/*alert("您已成功获得过"+prize+"！");*/
		}else if(result == -5){		// 开完了
			document.getElementById("type1").innerHTML = "<p>很遗憾，今天的宝箱已经开完了！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();	/*alert("您已成功获得过"+prize+"！");*/
		}else if(result == -6){		// 首笔不达标
			document.getElementById("type1").innerHTML = "<p>您今天首笔融资融币不符合开启本宝箱条件！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else if(result == -7){		// 未融资
			document.getElementById("type1").innerHTML = "<p>您还没有达到领取条件，快去融资融币吧！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = document.getElementById("coinMainUrl").value+"/lend/borrows.do";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			if(isMobile != 0) {
				document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			}
			showDialogBoxShadow();
		}else{		// 抽奖失败
			document.getElementById("type1").innerHTML = "<p>非常抱歉，领取失败</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();		/*alert("非常抱歉，领取失败");*/
		}
	}, "json");
}



/**
 * 十月狂欢 免息券
 */
function lottery_33(boxType) {
	var isMobile = document.getElementById("isMobile").value;
	//var boxType = jQuery(this).attr("value");
	var param={id:boxType};
	var url = "/active/lottery_33.do?random="+Math.round(Math.random()*100);
	jQuery.post(url,param,function(resultObj){
		var result = 0;
		if(resultObj != null){
			result = resultObj.result;
		}else{
			result = -100;
		}

		if(result == 0){   // 领取成功
			document.getElementById("type1").innerHTML = "<P>恭喜您获得了</p><em>"+resultObj.prizeName+"！</em>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			document.getElementById("dialog_closed").href = "javascript:window.location.reload();";
			showDialogBoxShadow();
			jQuery(".btn").addClass(" disabled");
		}else if(result == -1){		// 请求错误，跳到首页
			window.location.href=document.getElementById("coinMainUrl").value;
		}else if(result == -2){		// 活动结束
			document.getElementById("type1").innerHTML = "<p>抱歉，当前不是活动时间</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else if(result == -3){		//未登录
			document.getElementById("type1").innerHTML = "<p>请先登录</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			var loginUrl = "/user/login.do";
			if(isMobile != 0) {
				loginUrl = "/mobile/showLogin.do";
			}
			document.getElementById("popBtn").href=document.getElementById("coinMainUrl").value+loginUrl+"?forward="+encodeURIComponent(document.getElementById("referer").value);
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else if(result == -4){
			document.getElementById("type1").innerHTML = "<p>这张免息券太抢手，已经被领完了！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			document.getElementById("dialog_closed").href = "javascript:window.location.reload();";
			showDialogBoxShadow();
		}else if(result == -5){
			document.getElementById("type1").innerHTML = "<p>您还有免息券未使用，请用完再领！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else if(result == -6){
			document.getElementById("type1").innerHTML = "<p>您今天已经领过该免息券，试试其他吧！</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:closeDialogBoxShadow();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}else{	  //领取失败
			document.getElementById("type1").innerHTML = "<p>非常抱歉，领取失败</p>";
			document.getElementById("popBtn").innerHTML = "确定";
			document.getElementById("popBtn").href = "javascript:window.location.reload();";
			document.getElementById("dialog_closed").href = "javascript:closeDialogBoxShadow();";
			showDialogBoxShadow();
		}
	}, "json");
}